package org.xiaojl.modules.sys.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.xiaojl.common.base.BaseController;
import org.xiaojl.dwz.PageBean;
import org.xiaojl.dwz.PageParam;
import org.xiaojl.modules.sys.entity.SysLog;
import org.xiaojl.modules.sys.service.SysLogService;

/**
 * <p>
 * 系统日志表 前端控制器
 * </p>
 *
 * @author xiaojl
 * @since 2017-08-21
 */
@Controller
@RequestMapping("/sys/sysLog")
public class SysLogController extends BaseController{
	private static final Logger log = LoggerFactory.getLogger(SysLogController.class);
	private static final String basePagePath = "sys/log/";
	@Autowired
	private SysLogService sysLogService;
	
	@RequiresPermissions("sys/sysLog/list")
	@RequestMapping("/list")
	public ModelAndView list(PageParam pageParam, SysLog entity, Model model){
		try {
			PageBean<SysLog> pageBean = this.selectListPage(pageParam, entity, sysLogService);
			
			model.addAttribute("pageBean", pageBean);
			model.addAttribute("pageParam", pageParam);
			model.addAttribute("entity", entity);
			
			return operatePage(basePagePath+"list",model);
		} catch (Exception e) {
			log.error("查询列表数据出现异常:", e);
			return operateError("获取数据失败");
		}
	}
}
